1. Field of the Invention
This invention relates to a system and method for passing data from one object to another within an application in an object oriented processing system running multiple instances of the application.
2. Description of the Prior Art
In an object oriented processing system based on an object oriented language such as Java, C++ and the like, an xe2x80x9capplicationxe2x80x9d is a collection of one or more instances of objects that perform a specific function or task and an application xe2x80x9cinstancexe2x80x9d is one specific and independent case or request for an application""s functions comprising one set of the application""s object instances typically running in an assigned thread of execution. Data can be passed from one object to another object within an application via arguments to methods associated with the individual objects that comprise the application. This method of data passing has the difficult requirement that cooperating objects have advance knowledge of all the data that a called object will need, as well as all the data that will be needed by any object that works with the called object.
A second method for sharing data among objects in an object oriented processing system is the Java InfoBus API. The InfoBus API facilitates data communication between objects cooperating in the same Java Virtual Machine (JVM). Using the notion of a xe2x80x9cbus,xe2x80x9d the InfoBus API allows objects that implement it to xe2x80x9cplug intoxe2x80x9d the bus. Any xe2x80x9cplugged inxe2x80x9d member of the bus can exchange information with any other member in a structured way. The downside of sharing data through the InfoBus API is the lack of data persistence. Because the bus structure does not retain the data after its transmission, the data cannot be referenced at some later time.
A third method for providing data to remote objects (i.e., ones not called directly) is to place them in a shared location. By way of example, in a Java-based object oriented processing system, the JVM executes the series of objects that comprise one or more Java applications. A static hash table can be defined that allows the application objects to store and retrieve data using hash table xe2x80x9ckeyxe2x80x9d identifiers. Defining a static hash table to provide for storage and retrieval of data is desirable because the key identifiers and values of key identifiers are unknown to objects at compile time.
This method works well when only one instance of the application is executing in the JVM. However, it is often desirable to run multiple instances of the same application in multiple thread groups. For example, running multiple instances of an application simultaneously in an object oriented environment can be used to advantage in a telephone call center. Multiple incoming calls at the call center require simultaneous processing. This processing can be implemented by spawning new application instances as new calls arrive. The processing of multiple calls thus results in the simultaneous execution of multiple instances of the same application. A problem arises relative to data sharing in this situation because each application instance cannot have its own static hash table. A static hash table is a xe2x80x9cclassxe2x80x9d variable such that only one such table can reside within the JVM. Nor can multiple instances of an application running within a single JVM use the same static hash table to store local copies of data. Each application may require the placement of different information in the hash table and such storage in a single hash table might lead to data collisions.
Accordingly, there is a need in an object oriented computing environment for a system and method that allows multiple instances of applications to run simultaneously, with each spawned application instance having reliable access to its data. What is required is a system and method for providing an environment of variables and objects that are local to an application, and segregated from other applications running simultaneously therewith. (As used in this patent application, xe2x80x9cvariablexe2x80x9d is not limited to simple String or Integer values; rather, it refers to a specific instance of any object in an object oriented processing system.)
A system and method in accordance with the invention provides a global data sharing environment and data sharing proxy agent for multiple application instances in an object oriented processing system. In response to an object in an application instance calling a data storage or retrieval method for sharing data with other objects, the data is transparently stored in or retrieved from a local data sharing environment that corresponds to the requesting object""s application instance and is managed by the proxy agent within the global data sharing environment. The data sharing environment provides a xe2x80x9cstorexe2x80x9d where data to be shared persists until it is changed or deleted, or until the supporting JVM terminates.
In preferred embodiments of the invention, local data sharing environments are implemented by creating, for each application instance, a local hash table that stores or references the data to be shared among the objects of that application instance. These data or data references are keyed by data identifiers maintained in the key indexes of the local hash tables. The preferred implementation of the global data sharing environment includes a global hash table that stores or references the local hash tables. These local hash tables or hash table references are keyed by application instance identifiers. When an object in an application instance wishes to store data in or retrieve data from its local hash table, it issues a data sharing request using one of its local hash table data identifier keys. The proxy agent operating in the global data sharing environment processes the data sharing request by determining the application instance identifier corresponding to the application instance holding the object that made the data sharing request. The proxy agent queries the global hash table using the application instance identifier as a key to identify the local hash table that corresponds to the application instance to which the requesting object belongs. The proxy agent completes the data sharing transaction by querying the local hash table identified by the global hash table query using the data identifier provided by the requesting object as the key.